INCLUDE(CMakeForceCompiler)

# this one is important
SET(CMAKE_SYSTEM_NAME Linux)

SET(PLATFORM_PATH "$ENV{ANDROID_NDK_ROOT}/build/platforms/android-4")
IF(APPLE)
  set(PLATFORM_NAME "darwin-x86")
ELSEIF(UNIX)
  set(PLATFORM_NAME "linux-x86")
ENDIF(APPLE)

# specify the cross compiler
CMAKE_FORCE_C_COMPILER("$ENV{ANDROID_NDK_ROOT}/build/prebuilt/${PLATFORM_NAME}/arm-eabi-4.2.1/bin/arm-eabi-gcc" GNU)
CMAKE_FORCE_CXX_COMPILER("$ENV{ANDROID_NDK_ROOT}/build/prebuilt/${PLATFORM_NAME}/arm-eabi-4.2.1/bin/arm-eabi-g++" GNU)

# where is the target environment 
SET(CMAKE_FIND_ROOT_PATH "$ENV{ANDROID_NDK_ROOT}/build/prebuilt/${PLATFORM_NAME}/arm-eabi-4.2.1")

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

INCLUDE_DIRECTORIES(${PLATFORM_PATH}/arch-arm/usr/include)

